﻿using System;
using System.Runtime.Serialization;

namespace LuxDiner.Model.Products
{
    [DataContract]
    public class ProductModel : MBase
    {
        [Model(ConvertType = AttributeType.IgnoreUpdate)]
        [DataMember]
        public int ID { get; set; }
        [Model]
        [DataMember]
        public string ProductNo { get; set; }
        [Model]
        [DataMember]
        public string ProductName { get; set; }
        [Model]
        [DataMember]
        public string Pinyin { get; set; }
        [Model]
        [DataMember]
        public string UnitName { get; set; }
        [Model]
        [DataMember]
        public string AssistantUnitName { get; set; }
        [Model]
        [DataMember]
        public Nullable<int> AssistantUnitRate { get; set; }
        [Model]
        [DataMember]
        public int SortIndex { get; set; }
        [Model]
        [DataMember]
        public int Status { get; set; }

        #region Help
        [DataMember]
        public ProductCategoryCollection Categories { get; set; }

        [DataMember]
        public ProductUnitCollection Units { get; set; }

        [DataMember]
        public string ComplexName
        {
            get
            {
                return string.Format("{0}({1})", ProductName, ProductNo);
            }
        }

       
        #endregion
    }

    [DataContract]
    public class ProductCollection : ModelCollectionBase<ProductModel> { }
}
